import request from '@/utils/request'

export const login = data=>{
  return request({
    method:'post',
    url:'/v1_0/authorizations',
    data:data
  })
}

export const sendSms = mobile=>{
  return request({
    method:'get',
    url:`/v1_0/sms/codes/${mobile}`,
   
  })
}
export const getUserInfo = ()=>{
  return request({
    method:'get',
    url:'/v1_0/user',
    // headers:{
    //   Authorization:'Bearer ${store.state.user.token}'
    // }
  })
}

export const getUserChannels= ()=>{
  return request({
    method:'get',
    url:'/v1_0/user/channels',
    // headers:{
    //   Authorization:'Bearer ${store.state.user.token}'
    // }
  })
}

export const addFollow= target=>{
  return request({
    method:'post',
    url:'/v1_0/user/followings',
    data:{
      target
    }
  })
}

export const deleteFollow= target=>{
  return request({
    method:'delete',
    url:`/v1_0/user/followings/${target}`,
  })
}

// 获取当前用户的个人资料
export const getUserProfile = () =>{
  return request({
    method:'get',
    url:'/v1_0/user/profile'
  })
}

 // 更新用户资料
export const updateUserprofile  = () =>{
  return request({
    method:'patch',
    url:'/v1_0/user/profile'
  })
}

// 更新用户照片资料
export const updateUserPhoto = data =>{
  return request({
    method:'patch',
    url:'/v1_0/user/photo',
    data
  })
}